#ifndef _H_STM32_HAL_SPI_NORFLASH_H_
#define _H_STM32_HAL_SPI_NORFLASH_H_

#include "s_norflash_driver.h"

extern NorFlash_Handle norflash;

#define FLASH_ADDRESS(page, offset)     (((page) << 12) + (offset))

// extern signed char H_STM32_SPI_NorFlash_Test(void);
// extern signed char H_STM32_SPI_NorFlash_Init(void);
// extern signed char H_STM32_SPI1_Open(void);
// extern signed char H_STM32_SPI1_Close(void);
// extern signed char H_STM32_SPI1_ReadSectors(unsigned int sector_num, unsigned short sector_count, unsigned char *buf);
// extern signed char H_STM32_SPI1_WriteSectors(unsigned int sector_num, unsigned short sector_count, unsigned char *buf);
// extern signed char H_STM32_SPI1_ErasePage(unsigned short page);
// extern signed char H_STM32_SPI1_EraseChip(void);
// extern signed char H_STM32_SPI1_Read(unsigned int offset, unsigned short length, unsigned char *buf);
// extern signed char H_STM32_SPI1_Write(unsigned int offset, unsigned short length, unsigned char *buf);

extern signed char h_stm32_spi_norFlash_init(void);
extern signed char h_stm32_spi_norFlash_open(void);
extern signed char h_stm32_spi_norFlash_close(void);
extern signed char h_stm32_spi_norFlash_eraseChip(void);
extern signed char h_stm32_spi_norFlash_erasePage(unsigned short page);
extern signed char h_stm32_spi_norFlash_read(unsigned int offset, unsigned char *data, unsigned short len);
extern signed char h_stm32_spi_norFlash_write(unsigned int offset, const unsigned char *data, unsigned short len);
extern signed char h_stm32_spi_norFlash_readSectors(unsigned int sector_num, unsigned short sector_count, unsigned char *buf);
extern signed char h_stm32_spi_norFlash_writeSectors(unsigned int sector_num, unsigned short sector_count, unsigned char *buf);
#endif
